package com.lzx.spring3.meta;

public class Watch {

	long start = System.currentTimeMillis();

	long end;

	static ThreadLocal<Watch> threadLocal = new ThreadLocal<Watch>();

	public static void start() {
		Watch watch = threadLocal.get();
		if (watch == null) {
			watch = new Watch();
			threadLocal.set(watch);
		}
		watch.start = System.currentTimeMillis();
		watch.end = System.currentTimeMillis();
	}

	public static void dis() {
		Watch watch = threadLocal.get();
		watch.end = System.currentTimeMillis();

		System.out.println("watch time:" + (watch.end - watch.start));
		watch.start = System.currentTimeMillis();
	}

}
